import request from '@/utils/request'

// 用户登录
export const login = (data) => {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

// 用户注册
export const register = (data) => {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}

// 获取用户信息
export const getUserInfo = () => {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

// 更新用户信息
export const updateUserInfo = (data) => {
  return request({
    url: '/user/update',
    method: 'put',
    data
  })
}

// 修改密码
export const changePassword = (data) => {
  return request({
    url: '/user/password',
    method: 'put',
    data
  })
}

// 发送密码重置验证码
export const sendPasswordResetCode = (data) => {
  return request({
    url: '/user/forgot-password/send-code',
    method: 'post',
    data
  })
}

// 验证密码重置验证码
export const verifyPasswordResetCode = (data) => {
  return request({
    url: '/user/forgot-password/verify-code',
    method: 'post',
    data
  })
}

// 通过验证码重置密码
export const resetPasswordByCode = (data) => {
  return request({
    url: '/user/forgot-password/reset',
    method: 'post',
    data
  })
}